package com.iman.Confucius.mappers;

import com.iman.Confucius.mappers.models.DrmCourse;
import com.iman.Confucius.mappers.models.DrmCourseExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface DrmCourseMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int countByExample(DrmCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int deleteByExample(DrmCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    @Delete({
        "delete from drm_course",
        "where course_id = #{courseId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    @Insert({
        "insert into drm_course (course_id, course_tp, ",
        "course_nm, course_class, ",
        "org_price, cur_price, ",
        "course_times, only_pack, ",
        "course_limit_tp, course_limit, ",
        "course_credit, course_smart, ",
        "course_desc, course_lables, ",
        "course_cdt, ",
        "course_pdt, ",
        "course_onlinetp, create_uid, ",
        "course_no, course_teacherid, ",
        "course_teachernm, course_cancut, ",
        "course_flowyn, course_pimg, ",
        "course_subject)",
        "values (#{courseId,jdbcType=BIGINT}, #{courseTp,jdbcType=BIGINT}, ",
        "#{courseNm,jdbcType=VARCHAR}, #{courseClass,jdbcType=VARCHAR}, ",
        "#{orgPrice,jdbcType=BIGINT}, #{curPrice,jdbcType=BIGINT}, ",
        "#{courseTimes,jdbcType=INTEGER}, #{onlyPack,jdbcType=INTEGER}, ",
        "#{courseLimitTp,jdbcType=INTEGER}, #{courseLimit,jdbcType=INTEGER}, ",
        "#{courseCredit,jdbcType=INTEGER}, #{courseSmart,jdbcType=VARCHAR}, ",
        "#{courseDesc,jdbcType=VARCHAR}, #{courseLables,jdbcType=VARCHAR}, ",
        "#{courseCdt,jdbcType=TIMESTAMP,typeHandler=com.tuan800.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{coursePdt,jdbcType=TIMESTAMP,typeHandler=com.tuan800.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{courseOnlinetp,jdbcType=INTEGER}, #{createUid,jdbcType=BIGINT}, ",
        "#{courseNo,jdbcType=VARCHAR}, #{courseTeacherid,jdbcType=BIGINT}, ",
        "#{courseTeachernm,jdbcType=VARCHAR}, #{courseCancut,jdbcType=INTEGER}, ",
        "#{courseFlowyn,jdbcType=INTEGER}, #{coursePimg,jdbcType=VARCHAR}, ",
        "#{courseSubject,jdbcType=INTEGER})"
    })
    int insert(DrmCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int insertSelective(DrmCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    List<DrmCourse> selectByExample(DrmCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    @Select({
        "select",
        "course_id, course_tp, course_nm, course_class, org_price, cur_price, course_times, ",
        "only_pack, course_limit_tp, course_limit, course_credit, course_smart, course_desc, ",
        "course_lables, course_cdt, course_pdt, course_onlinetp, create_uid, course_no, ",
        "course_teacherid, course_teachernm, course_cancut, course_flowyn, course_pimg, ",
        "course_subject",
        "from drm_course",
        "where course_id = #{courseId,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    DrmCourse selectByPrimaryKey(Long courseId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int updateByExampleSelective(@Param("record") DrmCourse record, @Param("example") DrmCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int updateByExample(@Param("record") DrmCourse record, @Param("example") DrmCourseExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    int updateByPrimaryKeySelective(DrmCourse record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table drm_course
     *
     * @mbggenerated Sun Apr 19 19:14:28 CST 2015
     */
    @Update({
        "update drm_course",
        "set course_tp = #{courseTp,jdbcType=BIGINT},",
          "course_nm = #{courseNm,jdbcType=VARCHAR},",
          "course_class = #{courseClass,jdbcType=VARCHAR},",
          "org_price = #{orgPrice,jdbcType=BIGINT},",
          "cur_price = #{curPrice,jdbcType=BIGINT},",
          "course_times = #{courseTimes,jdbcType=INTEGER},",
          "only_pack = #{onlyPack,jdbcType=INTEGER},",
          "course_limit_tp = #{courseLimitTp,jdbcType=INTEGER},",
          "course_limit = #{courseLimit,jdbcType=INTEGER},",
          "course_credit = #{courseCredit,jdbcType=INTEGER},",
          "course_smart = #{courseSmart,jdbcType=VARCHAR},",
          "course_desc = #{courseDesc,jdbcType=VARCHAR},",
          "course_lables = #{courseLables,jdbcType=VARCHAR},",
          "course_cdt = #{courseCdt,jdbcType=TIMESTAMP,typeHandler=com.tuan800.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "course_pdt = #{coursePdt,jdbcType=TIMESTAMP,typeHandler=com.tuan800.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "course_onlinetp = #{courseOnlinetp,jdbcType=INTEGER},",
          "create_uid = #{createUid,jdbcType=BIGINT},",
          "course_no = #{courseNo,jdbcType=VARCHAR},",
          "course_teacherid = #{courseTeacherid,jdbcType=BIGINT},",
          "course_teachernm = #{courseTeachernm,jdbcType=VARCHAR},",
          "course_cancut = #{courseCancut,jdbcType=INTEGER},",
          "course_flowyn = #{courseFlowyn,jdbcType=INTEGER},",
          "course_pimg = #{coursePimg,jdbcType=VARCHAR},",
          "course_subject = #{courseSubject,jdbcType=INTEGER}",
        "where course_id = #{courseId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(DrmCourse record);
}